/* 
 -----------------------------------------------------------------------------
                   Cogaen - Component-based Game Engine (v3)
 -----------------------------------------------------------------------------
 This software is developed by the Cogaen Development Team. Please have a 
 look at our project home page for further details: http://www.cogaen.org
    
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Copyright (c) 2010 Roman Divotkey

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

package org.cogaen.java2d;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;

/**
 * Abstract base class of all screen classes.
 */
public abstract class Screen {

    /** Defines width and height of this screen instance. */
    protected Dimension size = new Dimension(0, 0);
    
    /**
     * Creates a new Screen instance.
     * 
     * @param screenSize  Dimension object defining height and width 
     *                    of this screen.
     */
    public Screen(Dimension screenSize) {
    	this.size.setSize(screenSize);
    }    
    
    /**
     * Creates a new Screen instance.
     * 
     * @param width   height of this screen instance in pixels
     * @param height  width of this screen instance in pixels
     */
    public Screen(int width, int height) {
    	this.size.setSize(width, height);
    }
    
    /**
     * Returns the width of this screen in pixels.
     * 
     * @return width of this screen.
     */
    public int getWidth() {
        return this.size.width;
    }

    /**
     * Returns the height of this screen in pixels.
     * 
     * @return height of this screen.
     */
    public int getHeight() {
        return this.size.height;
    }    
     
    /**
     * Returns the Java AWT component associated with this screen.
     * 
     * @return AWT component of this screen.
     */
    public abstract Component getComponent();
            
    /**
     * Returns a Java2D graphics context that can be used to render output 
     * onto this screen back buffer. 
     * 
     * <p>A call to <code>update</code> is needed in order to make
     * the output visible.</p>
     * 
     * @return Graphics2D object to render output.
     */
    public abstract Graphics2D getGraphicsContext();
    
    
    /**
     * Makes the current back buffer image visible and therefore becomes the
     * new front buffer image.
     */
    public abstract void update();    
    
    /**
     * Hides the mouse cursor in full screen mode. 
     */
    public abstract void hideMouseCursor();
    
    /**
     * Restores the mouse cursor.
     */
    public abstract void showMouseCursor();
    
    /**
     * Returns the current graphics configuration.
     * 
     * @return the current graphics configuration {@code GraphicsConfiguration}.
     */
    public abstract GraphicsConfiguration getGraphicsConfiguration();

    /**
     * Tells whether this screen is in fullscreen mode or in windowed mode.
     * 
     * @return {@code true if in fullscreen mode, {@code false} otherwise.
     */
    public abstract boolean isFullscreen();
}
